package com.newbingo.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;




import org.hibernate.annotations.Parent;

@Embeddable
public class BetSetting implements Serializable {
    
	private BettingCell bettingCell;//投注格
	private Agent agent;
	private Integer minBet;         //最小投注额
	private Integer maxBet;         //最大投注额

	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinColumn(name="bettingcell_id")
	public BettingCell getBettingCell() {
		return bettingCell;
	}

	public void setBettingCell(BettingCell bettingCell) {
		this.bettingCell = bettingCell;
	}

	public Integer getMinBet() {
		return minBet;
	}

	public void setMinBet(Integer minBet) {
		this.minBet = minBet;
	}

	public Integer getMaxBet() {
		return maxBet;
	}

	public void setMaxBet(Integer maxBet) {
		this.maxBet = maxBet;
	}
	//重写equals方法
	public boolean equals(Object o) {
		if (o instanceof BetSetting) {
			BetSetting bet = (BetSetting) o;
			if(this.getBettingCell().getId().equals(bet.getBettingCell().getId())
					&& this.getAgent().getUno().equals(bet.getAgent().getUno()))
				return true;
			else
				return false;
		}
		return false;
	}
	
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinColumn(name="agentid")
	public Agent getAgent() {
		return agent;
	}

	public void setAgent(Agent agent) {
		this.agent = agent;
	}
}
